#ifndef VERIFYCODEWIDGET_H
#define VERIFYCODEWIDGET_H

#include <QWidget>
#include <QRandomGenerator>
#include <QDateTime>
#include <QPainter>

class VerifyCodeWidget : public QWidget
{
    Q_OBJECT
public:
    explicit VerifyCodeWidget(QWidget *parent = nullptr);
    //仅生成验证码
    QString generateVerifyCode();

    //设置验证码并显示到界面上
    void refreshVerifyCode();

    //检测验证码是否匹配
    bool checkVerifyCode(const QString& verifyCode);

    //重写绘图事件
    void paintEvent(QPaintEvent *event);

    //重写鼠标点击事件
    void mousePressEvent(QMouseEvent *event);


private:
    QString verifyCode; //保存验证码
    QRandomGenerator randomGenerator; //随机数生成器

signals:
};

#endif // VERIFYCODEWIDGET_H
